<template>
  <div id="m1head1">
    <div>
      <div class="m1head_top">
        <router-link to="Fund"><img class="m1head_img" src="../assets/img/箭头.png" /></router-link> 
        
        <span class="m1head_title">首发基金</span>
      </div>
      <div id="m1content"  v-for="(item,index) in  it " :key="index">
        <div class="m1all_view">
            <div class="m1content_item">
            <div class="m1item_head">
   
                <span class="m1com_name">{{ item.fund_name | mess}}</span>
                <span class="m1com_name">{{ item.fund_no }}</span>
                <ul class="m1tag_view">
                <li class="m1tag_item" id="m1tag_item1">{{item.risk_type}}  </li>
                <li class="m1tag_item" id="m1tag_item2">{{item.invest}}</li>
                </ul>
            </div>
            <div class="m1cont_detail">{{ item.descs | mes}}</div>
            </div>
            <div class="m1foot">
                    <span class="m1send_tit">发行时间</span>
                    <span class="m1send_tit">{{item.first_time}}</span>
                </div>
            </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import  {publish} from "../api/vieew"
export default {
  data(){
        return {
          it:[

          ]
        }
 
      },
      created(){
       this.pub()
      },
  methods:{
         pub(){
          publish().then((res)=>{
            console.log(res.data);
          //  debugger
          if(res.data[0].invest==2 &&res.data[0].risk_type==2){
                  res.data[0].invest="股票型"
                  res.data[0].risk_type="债券型"
          } if(res.data[1].invest==2 &&res.data[1].risk_type==2){
            res.data[1].risk_type="债券型"
            res.data[1].invest="债券型"
             }
             if(res.data[2].invest==3 &&res.data[2].risk_type==3){
            res.data[2].risk_type="债券型"
            res.data[2].invest="债券型"
             }
             if(res.data[3].invest==3 &&res.data[3].risk_type==1){
            res.data[3].risk_type="货币型"
            res.data[3].invest="货币型"
             }
             if(res.data[4].invest==4 &&res.data[4].risk_type==1){
            res.data[4].risk_type="债券型"
            res.data[4].invest="股票型"
             }
             if(res.data[5].invest==3 &&res.data[5].risk_type==2){
            res.data[5].risk_type="股票型"
            res.data[5].invest="货币型"
             }
             if(res.data[6].invest==3 &&res.data[6].risk_type==1){
            res.data[6].risk_type="股票型"
            res.data[6].invest="混合型"
             }
          
         this.it=res.data
         
             
           
       })
         },
 
  },
  filters:{
    mess(val){
            if(val.length<=4){
            return val
         }
          return val.slice(0,4)+"..."
          },
          mes(val){
            if(val.length<=40){
            return val
         }
          return val.slice(0,40)+"···"
          }
          },
       
          }

</script>

<style  scoped src="../assets/css/view.css" >

</style>